﻿/*
 * 给定Item_Code(检验项代码)，列出这个检验项相关的所有信息：
 * 
 * 2009-5-12
 * */
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using EQT.Model;
using EQT.Dal;

public partial class TestItemTemplate : System.Web.UI.Page
{

    private DaTestItem dati = DevFuture.Common.WorkContext.AppCtx.GetObject("DaTestItem") as DaTestItem;
    private DaFileTemplate daft = DevFuture.Common.WorkContext.AppCtx.GetObject("DaFileTemplate") as DaFileTemplate;


    protected void Page_Load(object sender, EventArgs e)
    {       

        if (!Page.IsPostBack)
        {
            //查询字符串必须给定测试项ID
            string item_code = Request.QueryString["item_code"];
            if (!String.IsNullOrEmpty(item_code))
            {
                string brief= dati.GetTestItemBrief(item_code);
                if (brief.Length == 0)
                {
                    Utility.GlobalLog.ErrorFormat("给定的测试项代码{0}无效!", item_code);
                    Utility.SiteError(String.Format("给定的测试项代码{0}无效！", item_code));
                }
                else
                {
                    LabelTestItem.Text = brief;
                    //绑定此Test_Item拥有的所有文件模板 File_Template
                    DataSet ds = daft.GetTestItemFileTemplates(item_code);
                    GridViewTestItemTemplateFiles.DataSource = ds;
                    GridViewTestItemTemplateFiles.DataBind();
                }


            }




        }

    }
}
